package de.lunaplayer.view;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;

import de.lunaplayer.view.bars.Menubar;
import de.lunaplayer.view.bars.ToolbarPanel;
import de.lunaplayer.view.comp.AvatarChooser;
import de.lunaplayer.view.comp.StackLayout;
import de.lunaplayer.view.panels.ControllerPanel;
import de.lunaplayer.view.panels.LeftPanel;
import de.lunaplayer.view.panels.RightPanel;

@SuppressWarnings("serial")
public class Gui extends JFrame {
	
	private static int WIDTH = 1024,HEIGHT = 600;
	private Menubar menuBar;
	private ToolbarPanel toolBar;
	private ControllerPanel ctlPanel;
	private LeftPanel leftPanel;
	private RightPanel rightPanel;
	
	public Gui(){
		initialize();
		build();
		configurate();
	}

	private void initialize() {
		this.menuBar = new Menubar();
		this.toolBar = new ToolbarPanel();
		this.ctlPanel = new ControllerPanel();
		this.leftPanel = new LeftPanel();
		this.rightPanel = new RightPanel();
		
	}

	private void build() {
		JPanel pane = new JPanel();
        pane.setLayout(new StackLayout());      
        pane.add(new AvatarChooser(), StackLayout.TOP);
        add(pane,BorderLayout.CENTER);
        add(this.toolBar, BorderLayout.NORTH);
		add(this.ctlPanel, BorderLayout.SOUTH);
		add(this.leftPanel,BorderLayout.WEST);
		add(this.rightPanel, BorderLayout.EAST);
		pack();
		
	}
	
	private Dimension getPrefSize(){
		return new Dimension(WIDTH,HEIGHT);
	}

	private void configurate() {
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setSize(getPrefSize());
		setJMenuBar(menuBar);
		setVisible(true);
		
	}

}
